/*
 * Edge.h
 *	edges in a graph or tree
 *  Created on: Aug 30, 2012
 *      Author: hxu
 */

#ifndef EDGE_H_
#define EDGE_H_
#include "Point.h"

namespace Cxuh {

class Edge {
public:
	Edge();
	Edge(Point<int>& pt1_new, Point<int>& pt2_new);
	virtual ~Edge();
	void set_points(const Point<int>& pt1_new, const Point<int>& pt2_new);
	Edge* merge(const Edge& e2) const; // merge two edges
	bool is_contained(const Point<int>& pt1) const; // whether pt1 (on this edge) is contained between two terminals

	Point<int> get_pt_left() const;
	Point<int> get_pt_right() const;
	float get_slope() const;
private:
	Point<int> pt_l, pt_r;
	float slope;
	float yb; // intersection with y axis
};

} /* namespace Cxuh */
#endif /* EDGE_H_ */
